#pragma once
#include <iostream>
#include <map>
#include "lib\TCollection.h"
#include "model\Player.h"
#include "model\Sport.h"


class Presenter;
class IView;
class Command;
class BaseModel;

class Application {
public:
  Application();
  ~Application();
  
  static int GetId();

  void Init();
  void Dispatch(Command& command);
  void Run();
  void Quit();


private:
  // helper functions
  void PrintMenu();
  void PrintPlayer(const Player& player) const;
  void PrintSport(const Sport& sport) const;
  void PrintDivision(const Division& division) const;
  void PrintTeam(const Team& team) const;
  void PrintSchedule(std::vector<Match> matches) const;
  void PrintResult(std::vector<Match> matches) const;

  // commands
  void DisplayPlayer(Command& cmd);
  void DisplaySport(Command& cmd);
  void NewEntity(Command& cmd);
  void NewPlayer();
  void NewSport();
  void NewDivision();
  void DeleteEntity(Command& cmd);
  void DeletePlayer();
  void DeleteSport();
  void DeleteDivision();
  void WriteSchedule();
  void WriteResult();
  void ImportResults();


  void DisplayTeam();
  void EditTeam();


  bool quit_;
  static int last_id_;
  Presenter *presenter_;
  IView *view_;
  TCollection<Player> players_;
  TCollection<Sport> sports_;
};